<template>
    <div id="parts">
        <div class="operation">
            <el-button v-if="menuId==='4690'" @click="insertList" class="slot-btn-top" type="primary" size="small">
                发放任务
            </el-button>
            <el-button v-if="menuId==='4697'" @click="insertList" class="slot-btn-top" type="primary" size="small">
                发放任务
            </el-button>
        </div>
        <el-table :data="dataList.slice((currentPage-1)*pagesize,currentPage*pagesize)" :highlight-current-row="true" stripe border class="table-index" :height="tableHeight" style="width: 100%;" :header-cell-style="getRowClass">
            <el-table-column fixed type="index" label="*" sortable min-width="40"></el-table-column>
            <el-table-column prop="iecode" label="收支任务流水号" sor table min-width="160"></el-table-column>
            <el-table-column prop="szmc" label="收支名称" sortable min-width="300"></el-table-column>
            <el-table-column prop="jhje" label="收支计划金额" sortable min-width="130"></el-table-column>
            <el-table-column prop="sjje" label="收支实际金额" sortable min-width="130"></el-table-column>
            <el-table-column prop="jhyf" label="收支计划日期" :formatter="formatTimestampToDate" sortable min-width="130"></el-table-column>
            <el-table-column prop="szrwlx" label="收支任务类型" sortable min-width="130"></el-table-column>
            <el-table-column prop="bzry" label="任务发布人" sortable min-width="120"></el-table-column>
            <el-table-column prop="jhqdsj" label="计划启动时间" :formatter="formatTimestampToTime" sortable min-width="160"></el-table-column>
            <el-table-column prop="jhwcsj" label="计划完成时间" :formatter="formatTimestampToTime" sortable min-width="160"></el-table-column>
            <el-table-column fixed="right" label="操作" sortable align="center" width="90">
                <template slot-scope="scope">
                    <el-button @click="updateList(scope.row)" type="text" size="small">编辑</el-button>
                    <el-button @click="deleteList(scope.row)" type="text" size="small">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
                       :current-page="currentPage" :page-sizes="[5,10, 15,20, 25,30,50, 100]" :page-size="pagesize"
                       layout="total, sizes, prev, pager, next, jumper" :total="dataList.length"></el-pagination>

        <!-- 详情信息 -->
        <el-dialog :title="dialogTitle" width="90%" top="30px" :visible.sync="isDialog" :close-on-click-modal="false">
            <el-tabs v-model="activeName" @tab-click="handleClick" style="padding-bottom: 15px;">
                <el-tab-pane label="任务信息" name="1" class="dialog1" :style="dialogHeightPane">
                    <h3 class="dialog-plate-title"><span>基本信息</span></h3>
                    <el-form :inline="true" class="demo-form-inline" v-model="dialogList" label-position="right" label-width="180px">
                        <el-form-item label="收支任务流水号"><el-input v-model="dialogList.iecode" :disabled="!dialogListDisabled.iecode"></el-input></el-form-item>
                        <el-form-item label="收支名称">
                            <el-select v-model="dialogList.iename" :disabled="!dialogListDisabled.iename">
                                <el-option v-for="item in szmcName" :key="item.code" :value="item.code" :label="item.name"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="收支计划金额"><el-input v-model="dialogList.jhje" :disabled="!dialogListDisabled.jhje"></el-input></el-form-item>
                        <el-form-item label="收支计划日期"><el-date-picker v-model="dialogList.jhyf" :disabled="!dialogListDisabled.jhyf" type="date" placeholder="选择日期" style="width: 200px;"></el-date-picker></el-form-item>
                        <el-form-item label="财务人员">
                            <el-select v-model="dialogList.cwry" :disabled="!dialogListDisabled.cwry">
                                <el-option v-for="item in performName" :key="item.name" :value="item.name" :label="item.name"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="任务发布人"><el-input v-model="dialogList.bzry" :disabled="!dialogListDisabled.bzry"></el-input></el-form-item>
                        <el-form-item label="科目"><el-input v-model="dialogList.object" :disabled="!dialogListDisabled.object"></el-input></el-form-item>
                        <el-form-item label="收支类型"><el-select v-model="dialogList.szlx" :disabled="!dialogListDisabled.szlx"><el-option value="1" label="收入"></el-option><el-option value="2" label="支出"></el-option></el-select></el-form-item>
                       <el-form-item label="收支任务类型"><el-input v-model="dialogList.szrwlx" :disabled="!dialogListDisabled.szrwlx"></el-input></el-form-item>
                        <el-form-item label="计划添加时间"><el-input v-model="dialogList.jhtjsj" :disabled="!dialogListDisabled.jhtjsj"></el-input></el-form-item>

                    </el-form>

                    <h3 class="dialog-plate-title"><span>进行中信息</span></h3>
                    <el-form :inline="true" class="demo-form-inline" v-model="dialogList" label-position="right" label-width="180px">
                        <el-form-item label="计划是否启动">
                            <el-select v-model="dialogList.rwzt" :disabled="!dialogListDisabled.rwzt" @change="changeRwzt('rwzt','jhqdsj')">
                                <el-option label="否" :value="0"></el-option>
                                <el-option label="是" :value="1"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="计划启动时间"><el-input v-model="dialogList.jhqdsj" :disabled="!dialogListDisabled.jhqdsj" ></el-input></el-form-item>
                        <el-form-item label="收支实际金额"><el-input v-model="dialogList.sjje" :disabled="!dialogListDisabled.sjje"></el-input></el-form-item>
                        <el-form-item label="收支实际时间"><el-date-picker v-model="dialogList.sjsj" :disabled="!dialogListDisabled.sjsj"  format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间" style="width: 200px;"></el-date-picker></el-form-item>
                        <el-form-item label="计划是否完成"><el-select v-model="dialogList.rwwczt" :disabled="!dialogListDisabled.rwwczt" @change="changeRwzt('rwwczt','jhwcsj')">
                                <el-option label="否" :value="0"></el-option>
                                <el-option label="是" :value="1"></el-option>
                            </el-select></el-form-item>
                        <el-form-item label="计划完成时间"><el-input v-model="dialogList.jhwcsj" :disabled="!dialogListDisabled.jhwcsj"></el-input></el-form-item>
                    </el-form>
                    <div style="text-align: right">
                        <el-button @click="submitList" type="primary">确 定</el-button>
                    </div>
                </el-tab-pane>
                <el-tab-pane v-if="dialogType !== '1'" label="过程状态信息" name="2" :style="dialogHeightPane">
                    <el-button @click="insertNotesRecordList" type="primary" size="small" >新增</el-button>
                    <el-table :data="notesRecordData.slice((currentPage-1)*pagesize,currentPage*pagesize)" stripe border class="table-index" :height="dialogTableHeight" style="width: 99%;" :header-cell-style="getRowClass">
                        <el-table-column fixed type="index" label="*" sortable min-width="40"></el-table-column>
                        <el-table-column prop="txr" label="填写人" sortable min-width="120"></el-table-column>
                        <el-table-column prop="iedsj" label="填写时间" sortable min-width="160"></el-table-column>
                        <el-table-column prop="iednr" label="填写内容" sortable min-width="300"></el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" width="75">
                            <template slot-scope="scope">
                                <el-button @click="updateNotesRecordList(scope.row)" type="text" size="small">编辑</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[5,10, 15,20, 25,30,50, 100]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="notesRecordData.length"></el-pagination>
                </el-tab-pane>
            </el-tabs>
        </el-dialog>

        <!-- 备注记录信息 -->
        <el-dialog :title="dialogNotesRecordTitle" width="600px" center :visible.sync="isNotesRecordDialog" :close-on-click-modal="false" style="padding-bottom: 15px;">
            <el-form :inline="true" class="demo-form-inline" v-model="dialogNotesRecordList" label-position="right" label-width="180px">
                <el-form-item label="填写人">
                    <el-input v-model="dialogNotesRecordList.txr" disabled></el-input>
                </el-form-item>
                <el-form-item label="填写时间">
                    <el-input v-model="dialogNotesRecordList.iedsj" disabled></el-input>
                </el-form-item>
                <el-form-item label="填写内容">
                    <el-input type="textarea" :rows="8" v-model="dialogNotesRecordList.iednr"
                              style="width: 355px;"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer" style="text-align: right;"><el-button @click="submitNotesRecordList" type="primary">确 定</el-button>
            </div>
        </el-dialog>


    </div>
</template>

<script>
    export default {
        name: "",
        data() {
            let token = sessionStorage.getItem("tokenId");
            let menuId = sessionStorage.getItem('menuId');
            let tableHeight = (menuId === '4690' || menuId === '4697') ? (document.documentElement.clientHeight - 170) : (document.documentElement.clientHeight - 140);
            return {
                tokenId: token,
                menuId: menuId,
                currentPage: 1,
                pagesize: 10,
                activeName: '1',
                performName: [],
                bzryName: [],
                szmcName: [],
                tableHeight: tableHeight,
                dataList: [],

                //基本信息
                isDialog: false,
                dialogTitle: '',
                dialogType: '',
                dialogHeightPane: {
                    height: (document.documentElement.clientHeight - 180) + 'px',
                    overflowY: 'auto'
                },
                dialogTableHeight: document.documentElement.clientHeight - 280,
                dialogList: {
                    bzry: '',
                    cwry: '',
                    fzry: '',
                    iecode: '',
                    ieid: '',
                    iename: '',
                    szmc: '',
                    jhfbsj: '',
                    jhje: '',
                    jhqdsj: '',
                    jhtjsj: '',
                    jhwcsj: '',
                    jhyf: '',
                    object: '',
                    rwwczt: '',
                    rwzt: '',
                    sjje: '',
                    sjsj: '',
                    sjtotal: '',
                    sjwhereweek: '',
                    szlx: '',
                    szrwlx: '',
                    total: '',
                    whereweek: '',
                },
                dialogListDisabled: {
                    bzry: true,
                    cwry: true,
                    fzry: true,
                    iecode: true,
                    ieid: true,
                    iename: true,
                    jhfbsj: true,
                    jhje: true,
                    jhqdsj: true,
                    jhtjsj: true,
                    jhwcsj: true,
                    jhyf: true,
                    object: true,
                    rwwczt: true,
                    rwzt: true,
                    sjje: true,
                    sjsj: true,
                    sjtotal: true,
                    sjwhereweek: true,
                    szlx: true,
                    szrwlx: true,
                    total: true,
                    whereweek: true,
                    szmc: true,
                },

                //备注记录
                isNotesRecordDialog: false,
                dialogNotesRecordTitle: '',
                dialogNotesRecordList: {
                    iedid:'',
                    txr:'',
                    iedsj:'',
                    iednr:'',
                    ieid:'',
                },
                notesRecordData: [],

            };
        },
        created() {
            this.getData();
            this.getPerform();
            this.getBzry();
            this.getSzmc();
        },
        methods: {
            getPerform() {
                let _this = this;
                this.$http({
                    url: '/api/adscm/operation/cwIncomeexpenditure/queryCwry?tokenId=' + _this.tokenId,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'},
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.performName = res.data.content;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },
            getBzry() {
                let _this = this;
                this.$http({
                    url: '/api/adscm/operation/baseRysztm/queryBzry?tokenId=' + _this.tokenId,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'},
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.bzryName = res.data.content;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },
            getSzmc() {
                let _this = this;
                let id;
                if (_this.menuId === '4690' || _this.menuId === '4692' || _this.menuId === '4693') {
                    id = '1';
                } else if (_this.menuId === '4697' || _this.menuId === '4698' || _this.menuId === '4699') {
                    id = '2';
                }
                this.$http({
                    url: '/api/adscm/operation/baseRysztm/querySzmc?szlx='+id+'&tokenId=' + _this.tokenId,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'},
                }).then(function (res) {

                    console.log( res.data )

                    if (res.data.statusCode == 200) {
                        _this.szmcName = res.data.content;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },
            getData() {
                let _this = this;
                let loading = this.$loading({
                    target: document.querySelector(".wrapper > .content-box"),
                    lock: true,
                    text: '正在努力加载中...',
                    spinner: 'el-icon-loading',
                    background: 'rgba(0, 0, 0, 0.8)'
                });
                let id;
                if (_this.menuId === '4690') {
                    id = '?rwzt=0&rwwczt=0&szlx=1&tokenId=' + _this.tokenId;
                } else if (_this.menuId === '4692') {
                    id = '?rwzt=1&rwwczt=0&szlx=1&tokenId=' + _this.tokenId;
                } else if (_this.menuId === '4693') {
                    id = '?rwzt=1&rwwczt=1&szlx=1&tokenId=' + _this.tokenId;
                } else if (_this.menuId === '4697') {
                    id = '?rwzt=0&rwwczt=0&szlx=2&tokenId=' + _this.tokenId;
                } else if (_this.menuId === '4698') {
                    id = '?rwzt=1&rwwczt=0&szlx=2&tokenId=' + _this.tokenId;
                } else if (_this.menuId === '4699') {
                    id = '?rwzt=1&rwwczt=1&szlx=2&tokenId=' + _this.tokenId;
                }
                this.$http({
                    url: '/api/adscm/operation/cwIncomeexpenditure/queryByRWZT' + id,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'},
                }).then(function (res) {

                    console.log( res.data )

                    if (res.data.statusCode == 200) {
                        _this.dataList = res.data.content;
                        loading.close();
                    } else {
                        _this.$message.error(res.data.desc);
                        loading.close();
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                    loading.close();
                })
            },

            changeRwzt( isOk ,time){
                if ( this.dialogList[isOk] == 1) {
                    let date = new Date();
                    let Y = date.getFullYear() + '-';
                    let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
                    let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + " ";
                    let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ":";
                    let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ":";
                    let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
                    this.dialogList[time] =  Y + M + D + h + m + s;
                }
            },

            insertList() {
                this.isDialog = true;
                this.dialogType = '1';
                this.dialogListDisabled = {
                    iecode:false,
                    bzry:false,
                    object:false,
                    szlx:false,
                    iename:true,
                    jhje:true,
                    jhyf:true,
                    szrwlx:false,
                    jhtjsj:false,
                    rwzt:false,
                    jhqdsj:false,
                    sjje:false,
                    sjsj:false,
                    rwwczt:false,
                    jhwcsj:false,
                    cwry: true,
                    fzry: false,
                    ieid: false,
                    jhfbsj: false,
                    sjtotal: false,
                    sjwhereweek: false,
                    total: false,
                    whereweek: false,
                    szmc: false,
                };
                this.dialogList = {
                    bzry: '',
                    cwry: '',
                    fzry: '',
                    iecode: '',
                    ieid: '',
                    iename: '',
                    szmc: '',
                    jhfbsj: '',
                    jhje: '',
                    jhqdsj: '',
                    jhtjsj: this.this2Time(),
                    jhwcsj: '',
                    jhyf: '',
                    object: '',
                    rwwczt: '',
                    rwzt: '',
                    sjje: '',
                    sjsj: '',
                    sjtotal: '',
                    sjwhereweek: '',
                    szlx: (this.menuId === '4690' || this.menuId === '4692' || this.menuId === '4693') ? '1' : '2',
                    szrwlx: '',
                    total: '',
                    whereweek: '',
                };
            },
            updateList(row) {
                this.isDialog = true;
                this.dialogType = '2';
                this.activeName = '1';
                this.dialogListDisabled = {
                    iecode:false,
                    bzry:false,
                    object:false,
                    szlx:false,
                    iename:(this.menuId === '4690'  || this.menuId === '4697' || this.menuId === '4698') ? true : false ,
                    jhje:(this.menuId === '4690' || this.menuId === '4697' || this.menuId === '4698') ? true : false ,
                    jhyf:(this.menuId === '4690' || this.menuId === '4697' || this.menuId === '4698') ? true : false ,
                    szrwlx:false,
                    jhtjsj:false,
                    rwzt:(this.menuId === '4690' || this.menuId === '4697') ? true : false,
                    jhqdsj:false,
                    sjje:(this.menuId === '4692' ||  this.menuId === '4698') ? true : false,
                    sjsj:(this.menuId === '4692' || this.menuId === '4698') ? true : false,
                    rwwczt:(this.menuId === '4692' ||  this.menuId === '4698') ? true : false,
                    jhwcsj:false,
                    cwry: this.menuId === '4690' ? true : false,
                    fzry: false,
                    ieid: false,
                    jhfbsj: false,
                    sjtotal: false,
                    sjwhereweek: false,
                    total: false,
                    whereweek: false,
                    szmc: false,

                };
                this.dialogList = row;
                this.dialogList.szlx = this.dialogList.szlx+'';
            },
            deleteList(row) {
                console.log( row.ieid )
                let _this = this;
                let param = new URLSearchParams();
                param.append('data', JSON.stringify(row));

                this.$confirm('是否删除此条记录?', '提示', {
                    confirmButtonClass: 'el-button--warning'
                }).then(() => {
                    _this.$http({
                        url: '/api/adscm/operation/cwIncomeexpenditure/delete?tokenId=' + _this.tokenId,
                        method: 'post',
                        headers: {'deviceCode': 'A95ZEF1-47B5-AC90BF3'},
                        data: param,
                    }).then(function (res) {
                        if (res.data.statusCode == 200) {
                            _this.$message.success(res.data.desc);
                            _this.getData();
                        } else {_this.$message.error(res.data.desc);}
                    }).catch(function (catchres) {_this.$message.error("加载失败！请重新加载...");})
                }).catch(() => {});
            },
            submitList() {
                let _this = this;
                let url;
                if (_this.dialogType === '1') {
                    url = '/api/adscm/operation/cwIncomeexpenditure/insert?tokenId=' + _this.tokenId;
                } else if (_this.dialogType === '2') {
                    url = '/api/adscm/operation/cwIncomeexpenditure/update?tokenId=' + _this.tokenId;
                }
                _this.dialogList.jhyf = _this.timestampToTime(_this.dialogList.jhyf);
                _this.dialogList.sjsj = _this.timestampToTime(_this.dialogList.sjsj);

                let param = new URLSearchParams();
                param.append('data', JSON.stringify(_this.dialogList));

                console.log( _this.dialogList )

                this.$http({
                    url: url,
                    method: 'post',
                    headers: {'deviceCode': 'A95ZEF1-47B5-AC90BF3'},
                    data: param,
                }).then(function (res) {

                    console.log( res.data )


                    if (res.data.statusCode == 200) {
                        _this.isDialog = false;
                        _this.getData();
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },

            //备注记录信息
            getNotesRecordData() {
                let _this = this;
                this.$http({
                    url: '/api/adscm/operation/cwIedetailinfo/queryByIeDid?iedid=' +_this.dialogList.ieid+ '&tokenId=' + _this.tokenId,
                    method: 'post',
                    headers: {'X-Requested-With': 'XMLHttpRequest'},
                }).then(function (res) {
                    if (res.data.statusCode == 200) {
                        _this.notesRecordData = res.data.content;
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },
            insertNotesRecordList() {
                this.isNotesRecordDialog = true;
                this.dialogNotesRecordTitle = '添加';
                this.dialogNotesRecordList = {
                    iedid:'',
                    txr:'',
                    iedsj:this.this2Time(),
                    iednr:'',
                    ieid:this.dialogList.ieid,
                };
            },
            updateNotesRecordList(row) {

                console.log( row )

                this.isNotesRecordDialog = true;
                this.dialogNotesRecordTitle = '编辑';
                this.dialogNotesRecordList = row;
            },
            submitNotesRecordList() {
                let _this = this;
                let url;
                if (_this.dialogNotesRecordTitle === '添加') {
                    url = '/api/adscm/operation/cwIedetailinfo/insert?tokenId=' + _this.tokenId;
                } else if (_this.dialogNotesRecordTitle === '编辑') {
                    url = '/api/adscm/operation/cwIedetailinfo/update?tokenId=' + _this.tokenId;
                }
                let param = new URLSearchParams();
                param.append('data', JSON.stringify(_this.dialogNotesRecordList));

                console.log( _this.dialogNotesRecordList )

                this.$http({
                    url: url,
                    method: 'post',
                    headers: {'deviceCode': 'A95ZEF1-47B5-AC90BF3'},
                    data: param,
                }).then(function (res) {

                    console.log( res.data )

                    if (res.data.statusCode == 200) {
                        _this.isNotesRecordDialog = false;
                        _this.getNotesRecordData();
                    } else {
                        _this.$message.error(res.data.desc);
                    }
                }).catch(function (catchres) {
                    _this.$message.error("加载失败！请重新加载...");
                })
            },

            handleClick(tab, event) {
                if (tab.name === '2') {
                    this.getNotesRecordData();
                }

            },
            handleSizeChange: function (size) {
                this.pagesize = size;
            },
            handleCurrentChange: function (currentPage) {
                this.currentPage = currentPage;
            },
            formatTimestampToTime:function(row, column, cellValue, index) {
                return cellValue ? this.timestampToTime(cellValue) : '';
            },
            formatTimestampToDate:function(row, column, cellValue, index) {
                return cellValue ? this.timestampToTime(cellValue).substr(0,10) : '';
            },
            timestampToTime(timestamp) {
                if (timestamp) {
                    let date = new Date(timestamp);
                    let Y = date.getFullYear() + '-';
                    let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
                    let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + " ";
                    let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ":";
                    let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ":";
                    let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
                    return timestamp ? Y + M + D + h + m + s : '';
                } else {
                    return '';
                }
            },
            this2Time() {
                    let date = new Date();
                    let Y = date.getFullYear() + '-';
                    let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
                    let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + " ";
                    let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ":";
                    let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ":";
                    let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
                    return  Y + M + D + h + m + s ;
            },
        }
    }
</script>

<style scoped>

    #parts .el-table--small {
        font-size: 13px;
    }

    #parts .el-table .cell,
    #parts .el-table th div {
        padding-left: 0;
        padding-right: 0;
    }

    #parts .el-tab-pane.dialog1 .el-form {
        margin-bottom: 30px;
    }

</style>
